import request from '@/utils/request'

// 分页查询关注列表
export function list(query) {
  return request({
    url: '/system/user/follows/list',
    method: 'get',
    params: query
  })
}

// 关注用户
export function follow(followerId, followedId) {
  return request({
    url: '/system/user/follows/follow',
    method: 'post',
    params: {
      followerId,
      followedId
    }
  })
}

// 取消关注
export function unfollow(followerId, followedId) {
  return request({
    url: '/system/user/follows/unfollow',
    method: 'post',
    params: {
      followerId,
      followedId
    }
  })
}

// 获取我关注的人ID集合
export function getFollowedIds(followerId) {
  return request({
    url: '/system/user/follows/followedIds/' + followerId,
    method: 'get'
  })
}

// 获取我的粉丝ID集合
export function getFollowerIds(followedId) {
  return request({
    url: '/system/user/follows/followerIds/' + followedId,
    method: 'get'
  })
}

// 判断双方是否互相关注
export function isFollowEach(uid1, uid2) {
  return request({
    url: '/system/user/follows/isFollowEach',
    method: 'get',
    params: {
      uid1,
      uid2
    }
  })
}

// 获取关注数
export function countFollowed(followerId) {
  return request({
    url: '/system/user/follows/countFollowed/' + followerId,
    method: 'get'
  })
}

// 获取粉丝数
export function countFollower(followedId) {
  return request({
    url: '/system/user/follows/countFollower/' + followedId,
    method: 'get'
  })
}

// 获取共同关注的人
export function commonFollows(uid1, uid2, limit) {
  return request({
    url: '/system/user/follows/commonFollows',
    method: 'get',
    params: {
      uid1,
      uid2,
      limit
    }
  })
}